insert overwrite table jms_dws.dws_customer_hour_cnt_dt partition(dt)
select
      dt                  as input_date
     ,hour(input_time)    as input_hour
     ,customer_name
     ,customer_code
     ,attribute_id
     ,create_time
     ,sum(1)              as ticket_quantity
     ,franchisee_code
     ,franchisee_name
     ,agent_code
     ,agent_name
     ,provider_id
     ,city_id
     ,area_id
     ,provider_desc
     ,city_desc
     ,area_desc
     ,pick_network_code
     ,pick_network_name
     ,dt
from jms_dwd.dwd_customer_detail_dt
  where dt = '{{ execution_date | cst_ds }}'
group by
      hour(input_time)
     ,customer_name
     ,customer_code
     ,attribute_id
     ,create_time
     ,franchisee_code
     ,franchisee_name
     ,agent_code
     ,agent_name
     ,provider_id
     ,city_id
     ,area_id
     ,provider_desc
     ,city_desc
     ,area_desc
     ,pick_network_code
     ,pick_network_name
     ,dt
  distribute by 1  ;